home *** CD-ROM | disk | FTP | other *** search
/ Dynamic HTML Construction Kit / Dynamic HTML Construction Kit.iso / source_code / dhtmlunl / dhtml.exe / CD Content / Chap23 / dun23_7.txt < prev    next >
Encoding:
Text File  |  1997-12-18  |  1.1 KB  |  36 lines

  1. <html>
  2.  
  3. <head>
  4.  
  5. <title>Script Dilemma</title>
  6.  
  7. </head>
  8.  
  9.    <script>
  10.  
  11.    <!--//
  12.  
  13.    function usrMessage(st) {
  14.  
  15.        return prompt('Parent Window\n' + st, '');
  16.  
  17.    }
  18.  
  19.    //--->
  20.  
  21.    </script>
  22.  
  23. <body bgcolor="white">
  24.  
  25. <layer id="first" width=100 height=40 top=0 left=0>
  26.  
  27.    <script>
  28.  
  29.    <!--//
  30.  
  31.    function usrMessage(st) {
  32.  
  33.        return prompt('document.layers[\'first\'].document.layers[\'firstsub\'].\n' + st, '');
  34.  
  35.    }
  36.  
  37.    //--->
  38.  
  39.    </script>
  40.  
  41. </layer>
  42.  
  43.  
  44.  
  45. <layer id="second" width=100 height=40 top=45 left=0>
  46.  
  47.    <layer id="secondsub" width=96 height=36 top=2 left=2>
  48.  
  49.       <layer id="subchild1" width=50 height=30 top=3 left=3>
  50.  
  51.       <!--this one calls the usrMessage in the first document layer -->
  52.  
  53.       <a href="javascript:alert('Hi ' + document.layers['first'].usrMessage('What\'s Your Name?')+'!')">CLICK</a>
  54.  
  55.       <!--this one calls the usrMessage at the head of the document -->
  56.  
  57.       <a href="javascript:alert('Hi ' + usrMessage('What\'s Your Name?')+'!')">HERE</a>
  58.  
  59.       </layer>
  60.  
  61.    </layer>
  62.  
  63. </layer>
  64.  
  65.  
  66.  
  67. </body>
  68.  
  69. </html>
  70.  
  71.